from math import log2

def sedgewick(n):
    if n%2 == 0:
        return 9*(4**(n//2)-2**(n//2))+1
    else:
        return 4**((n+3)//2)-3*2**((n+3)//2)+1

def hibbard(n):
    return 2**n-1

def shell_sort(array):
    n=len(array)
    k=int(log2(n))-1
    while k > 0:
        gap=hibbard(k)
        for i in range(gap,n):
            number=array[i]
            j=i
            while j > gap-1 and array[j-gap] > number:
                array[j]=array[j-gap]
                j-=gap
            array[j]=number
        k-=1

array=[35,33,42,10,14,19,27,44]
print(array)
shell_sort(array)
print(array)